<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Array</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            Array 
            
                <span class="parent">&lt; 
                    
                    <a href="Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/array/access_rb.html">activesupport/lib/active_support/core_ext/array/access.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/array/conversions_rb.html">activesupport/lib/active_support/core_ext/array/conversions.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/array/extract_options_rb.html">activesupport/lib/active_support/core_ext/array/extract_options.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/array/grouping_rb.html">activesupport/lib/active_support/core_ext/array/grouping.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/array/prepend_and_append_rb.html">activesupport/lib/active_support/core_ext/array/prepend_and_append.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/array/uniq_by_rb.html">activesupport/lib/active_support/core_ext/array/uniq_by.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/array/wrap_rb.html">activesupport/lib/active_support/core_ext/array/wrap.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/blank_rb.html">activesupport/lib/active_support/core_ext/object/blank.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/deep_dup_rb.html">activesupport/lib/active_support/core_ext/object/deep_dup.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/to_param_rb.html">activesupport/lib/active_support/core_ext/object/to_param.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/object/to_query_rb.html">activesupport/lib/active_support/core_ext/object/to_query.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/json/encoding_rb.html">activesupport/lib/active_support/json/encoding.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Array.html#method-i-deep_dup">deep_dup</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Array.html#method-i-extract_options-21">extract_options!</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>F</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Array.html#method-i-fifth">fifth</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-forty_two">forty_two</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-fourth">fourth</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-from">from</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Array.html#method-i-in_groups">in_groups</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-in_groups_of">in_groups_of</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Array.html#method-i-second">second</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-split">split</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Array.html#method-i-third">third</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-to">to</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-to_default_s">to_default_s</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-to_formatted_s">to_formatted_s</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-to_param">to_param</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-to_query">to_query</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-to_s">to_s</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-to_sentence">to_sentence</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-to_xml">to_xml</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>U</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Array.html#method-i-uniq_by">uniq_by</a>,
              </li>
            
              
              <li>
                <a href="Array.html#method-i-uniq_by-21">uniq_by!</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>W</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Array.html#method-c-wrap">wrap</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-wrap">
            
              <b>wrap</b>(object)
            
            <a href="Array.html#method-c-wrap" name="method-c-wrap" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Wraps its argument in an array unless it is already an array (or
array-like).</p>

<p>Specifically:</p>
<ul><li>
<p>If the argument is <code>nil</code> an empty list is returned.</p>
</li><li>
<p>Otherwise, if the argument responds to <code>to_ary</code> it is invoked,
and its result returned.</p>
</li><li>
<p>Otherwise, returns an array with the argument as its single element.</p>

<pre class="ruby"><span class="ruby-constant">Array</span>.<span class="ruby-identifier">wrap</span>(<span class="ruby-keyword">nil</span>)       <span class="ruby-comment"># =&gt; []</span>
<span class="ruby-constant">Array</span>.<span class="ruby-identifier">wrap</span>([<span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>]) <span class="ruby-comment"># =&gt; [1, 2, 3]</span>
<span class="ruby-constant">Array</span>.<span class="ruby-identifier">wrap</span>(<span class="ruby-value">0</span>)         <span class="ruby-comment"># =&gt; [0]</span>
</pre>
</li></ul>

<p>This method is similar in purpose to <code>Kernel#Array</code>, but there
are some differences:</p>
<ul><li>
<p>If the argument responds to <code>to_ary</code> the method is invoked.
<code>Kernel#Array</code> moves on to try <code>to_a</code> if the returned
value is <code>nil</code>, but <code>Array.wrap</code> returns
<code>nil</code> right away.</p>
</li><li>
<p>If the returned value from <code>to_ary</code> is neither <code>nil</code>
nor an <code>Array</code> object, <code>Kernel#Array</code> raises an
exception, while <code>Array.wrap</code> does not, it just returns the
value.</p>
</li><li>
<p>It does not call <code>to_a</code> on the argument, but returns an empty
array if argument is <code>nil</code>.</p>
</li></ul>

<p>The second point is easily explained with some enumerables:</p>

<pre class="ruby"><span class="ruby-constant">Array</span>(<span class="ruby-identifier">foo</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">bar</span>)      <span class="ruby-comment"># =&gt; [[:foo, :bar]]</span>
<span class="ruby-constant">Array</span>.<span class="ruby-identifier">wrap</span>(<span class="ruby-identifier">foo</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">bar</span>) <span class="ruby-comment"># =&gt; [{:foo=&gt;:bar}]</span>
</pre>

<p>There’s also a related idiom that uses the splat operator:</p>

<pre>[*object]</pre>

<p>which returns <code>[]</code> for <code>nil</code>, but calls to
<code>Array(object)</code> otherwise.</p>

<p>The differences with <code>Kernel#Array</code> explained above apply to the
rest of <code>object</code>s.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-wrap_source')" id="l_method-c-wrap_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/5ba1b594aa866020fb62b961fae61a09529092a4/activesupport/lib/active_support/core_ext/array/wrap.rb#L36" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-wrap_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/wrap.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">wrap</span>(<span class="ruby-identifier">object</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">nil?</span>
    []
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_ary</span>)
    <span class="ruby-identifier">object</span>.<span class="ruby-identifier">to_ary</span> <span class="ruby-operator">||</span> [<span class="ruby-identifier">object</span>]
  <span class="ruby-keyword">else</span>
    [<span class="ruby-identifier">object</span>]
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-deep_dup">
            
              <b>deep_dup</b>()
            
            <a href="Array.html#method-i-deep_dup" name="method-i-deep_dup" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a deep copy of array.</p>

<pre class="ruby"><span class="ruby-identifier">array</span> = [<span class="ruby-value">1</span>, [<span class="ruby-value">2</span>, <span class="ruby-value">3</span>]]
<span class="ruby-identifier">dup</span>   = <span class="ruby-identifier">array</span>.<span class="ruby-identifier">deep_dup</span>
<span class="ruby-identifier">dup</span>[<span class="ruby-value">1</span>][<span class="ruby-value">2</span>] = <span class="ruby-value">4</span>

<span class="ruby-identifier">array</span>[<span class="ruby-value">1</span>][<span class="ruby-value">2</span>] <span class="ruby-comment">#=&gt; nil</span>
<span class="ruby-identifier">dup</span>[<span class="ruby-value">1</span>][<span class="ruby-value">2</span>]   <span class="ruby-comment">#=&gt; 4</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-deep_dup_source')" id="l_method-i-deep_dup_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/019df9887519701b321c668c1d27d5c0c26fee7a/activesupport/lib/active_support/core_ext/object/deep_dup.rb#L27" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-deep_dup_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/deep_dup.rb, line 27</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">deep_dup</span>
  <span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">it</span><span class="ruby-operator">|</span> <span class="ruby-identifier">it</span>.<span class="ruby-identifier">deep_dup</span> }
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-extract_options-21">
            
              <b>extract_options!</b>()
            
            <a href="Array.html#method-i-extract_options-21" name="method-i-extract_options-21" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Extracts options from a set of arguments. Removes and returns the last
element in the array if it’s a hash, otherwise returns a blank hash.</p>

<pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier">options</span>(*<span class="ruby-identifier">args</span>)
  <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>
<span class="ruby-keyword">end</span>

<span class="ruby-identifier">options</span>(<span class="ruby-value">1</span>, <span class="ruby-value">2</span>)        <span class="ruby-comment"># =&gt; {}</span>
<span class="ruby-identifier">options</span>(<span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-identifier">a</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">b</span>) <span class="ruby-comment"># =&gt; {:a=&gt;:b}</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-extract_options-21_source')" id="l_method-i-extract_options-21_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/794a70f94485fb64ed1c49ba8532895306e2001c/activesupport/lib/active_support/core_ext/array/extract_options.rb#L22" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-extract_options-21_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/extract_options.rb, line 22</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">extract_options!</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">last</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">last</span>.<span class="ruby-identifier">extractable_options?</span>
    <span class="ruby-identifier">pop</span>
  <span class="ruby-keyword">else</span>
    {}
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-fifth">
            
              <b>fifth</b>()
            
            <a href="Array.html#method-i-fifth" name="method-i-fifth" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Equal to <code>self[4]</code>.</p>

<pre class="ruby"><span class="ruby-node">%w( a b c d e )</span>.<span class="ruby-identifier">fifth</span> <span class="ruby-comment"># =&gt; &quot;e&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-fifth_source')" id="l_method-i-fifth_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/139461fc144983186c96bd50388d463895201ad3/activesupport/lib/active_support/core_ext/array/access.rb#L46" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-fifth_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/access.rb, line 46</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">fifth</span>
  <span class="ruby-keyword">self</span>[<span class="ruby-number">4</span>]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-forty_two">
            
              <b>forty_two</b>()
            
            <a href="Array.html#method-i-forty_two" name="method-i-forty_two" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Equal to <code>self[41]</code>. Also known as accessing “the reddit”.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-forty_two_source')" id="l_method-i-forty_two_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/139461fc144983186c96bd50388d463895201ad3/activesupport/lib/active_support/core_ext/array/access.rb#L51" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-forty_two_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/access.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">forty_two</span>
  <span class="ruby-keyword">self</span>[<span class="ruby-number">41</span>]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-fourth">
            
              <b>fourth</b>()
            
            <a href="Array.html#method-i-fourth" name="method-i-fourth" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Equal to <code>self[3]</code>.</p>

<pre class="ruby"><span class="ruby-node">%w( a b c d e )</span>.<span class="ruby-identifier">fourth</span> <span class="ruby-comment"># =&gt; &quot;d&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-fourth_source')" id="l_method-i-fourth_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/139461fc144983186c96bd50388d463895201ad3/activesupport/lib/active_support/core_ext/array/access.rb#L39" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-fourth_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/access.rb, line 39</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">fourth</span>
  <span class="ruby-keyword">self</span>[<span class="ruby-number">3</span>]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-from">
            
              <b>from</b>(position)
            
            <a href="Array.html#method-i-from" name="method-i-from" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the tail of the array from <code>position</code>.</p>

<pre class="ruby"><span class="ruby-node">%w( a b c d )</span>.<span class="ruby-identifier">from</span>(<span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;]</span>
<span class="ruby-node">%w( a b c d )</span>.<span class="ruby-identifier">from</span>(<span class="ruby-value">2</span>)  <span class="ruby-comment"># =&gt; [&quot;c&quot;, &quot;d&quot;]</span>
<span class="ruby-node">%w( a b c d )</span>.<span class="ruby-identifier">from</span>(<span class="ruby-value">10</span>) <span class="ruby-comment"># =&gt; []</span>
<span class="ruby-node">%w()</span>.<span class="ruby-identifier">from</span>(<span class="ruby-value">0</span>)           <span class="ruby-comment"># =&gt; []</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-from_source')" id="l_method-i-from_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/139461fc144983186c96bd50388d463895201ad3/activesupport/lib/active_support/core_ext/array/access.rb#L8" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-from_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/access.rb, line 8</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">from</span>(<span class="ruby-identifier">position</span>)
  <span class="ruby-keyword">self</span>[<span class="ruby-identifier">position</span>, <span class="ruby-identifier">length</span>] <span class="ruby-operator">||</span> []
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-in_groups">
            
              <b>in_groups</b>(number, fill_with = nil)
            
            <a href="Array.html#method-i-in_groups" name="method-i-in_groups" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Splits or iterates over the array in <code>number</code> of groups, padding
any remaining slots with <code>fill_with</code> unless it is
<code>false</code>.</p>

<pre class="ruby"><span class="ruby-node">%w(1 2 3 4 5 6 7 8 9 10)</span>.<span class="ruby-identifier">in_groups</span>(<span class="ruby-value">3</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span> <span class="ruby-identifier">group</span>}
[<span class="ruby-string">&quot;1&quot;</span>, <span class="ruby-string">&quot;2&quot;</span>, <span class="ruby-string">&quot;3&quot;</span>, <span class="ruby-string">&quot;4&quot;</span>]
[<span class="ruby-string">&quot;5&quot;</span>, <span class="ruby-string">&quot;6&quot;</span>, <span class="ruby-string">&quot;7&quot;</span>, <span class="ruby-keyword">nil</span>]
[<span class="ruby-string">&quot;8&quot;</span>, <span class="ruby-string">&quot;9&quot;</span>, <span class="ruby-string">&quot;10&quot;</span>, <span class="ruby-keyword">nil</span>]

<span class="ruby-node">%w(1 2 3 4 5 6 7 8 9 10)</span>.<span class="ruby-identifier">in_groups</span>(<span class="ruby-value">3</span>, <span class="ruby-string">'&amp;nbsp;'</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span> <span class="ruby-identifier">group</span>}
[<span class="ruby-string">&quot;1&quot;</span>, <span class="ruby-string">&quot;2&quot;</span>, <span class="ruby-string">&quot;3&quot;</span>, <span class="ruby-string">&quot;4&quot;</span>]
[<span class="ruby-string">&quot;5&quot;</span>, <span class="ruby-string">&quot;6&quot;</span>, <span class="ruby-string">&quot;7&quot;</span>, <span class="ruby-string">&quot;&amp;nbsp;&quot;</span>]
[<span class="ruby-string">&quot;8&quot;</span>, <span class="ruby-string">&quot;9&quot;</span>, <span class="ruby-string">&quot;10&quot;</span>, <span class="ruby-string">&quot;&amp;nbsp;&quot;</span>]

<span class="ruby-node">%w(1 2 3 4 5 6 7)</span>.<span class="ruby-identifier">in_groups</span>(<span class="ruby-value">3</span>, <span class="ruby-keyword">false</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span> <span class="ruby-identifier">group</span>}
[<span class="ruby-string">&quot;1&quot;</span>, <span class="ruby-string">&quot;2&quot;</span>, <span class="ruby-string">&quot;3&quot;</span>]
[<span class="ruby-string">&quot;4&quot;</span>, <span class="ruby-string">&quot;5&quot;</span>]
[<span class="ruby-string">&quot;6&quot;</span>, <span class="ruby-string">&quot;7&quot;</span>]
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-in_groups_source')" id="l_method-i-in_groups_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/3c4a0b2e6807cfb67d4ee76a15c8b8a242f12bdf/activesupport/lib/active_support/core_ext/array/grouping.rb#L57" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-in_groups_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/grouping.rb, line 57</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">in_groups</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">fill_with</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-comment"># size / number gives minor group size;</span>
  <span class="ruby-comment"># size % number gives how many objects need extra accommodation;</span>
  <span class="ruby-comment"># each group hold either division or division + 1 items.</span>
  <span class="ruby-identifier">division</span> = <span class="ruby-identifier">size</span>.<span class="ruby-identifier">div</span> <span class="ruby-identifier">number</span>
  <span class="ruby-identifier">modulo</span> = <span class="ruby-identifier">size</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">number</span>

  <span class="ruby-comment"># create a new array avoiding dup</span>
  <span class="ruby-identifier">groups</span> = []
  <span class="ruby-identifier">start</span> = <span class="ruby-number">0</span>

  <span class="ruby-identifier">number</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">length</span> = <span class="ruby-identifier">division</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">modulo</span> <span class="ruby-operator">&gt;</span> <span class="ruby-number">0</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">modulo</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">?</span> <span class="ruby-number">1</span> <span class="ruby-operator">:</span> <span class="ruby-number">0</span>)
    <span class="ruby-identifier">groups</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">last_group</span> = <span class="ruby-identifier">slice</span>(<span class="ruby-identifier">start</span>, <span class="ruby-identifier">length</span>)
    <span class="ruby-identifier">last_group</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">fill_with</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">fill_with</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">false</span> <span class="ruby-operator">&amp;&amp;</span>
      <span class="ruby-identifier">modulo</span> <span class="ruby-operator">&gt;</span> <span class="ruby-number">0</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">division</span>
    <span class="ruby-identifier">start</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">length</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-identifier">groups</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-keyword">yield</span>(<span class="ruby-identifier">g</span>) }
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">groups</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-in_groups_of">
            
              <b>in_groups_of</b>(number, fill_with = nil)
            
            <a href="Array.html#method-i-in_groups_of" name="method-i-in_groups_of" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Splits or iterates over the array in groups of size <code>number</code>,
padding any remaining slots with <code>fill_with</code> unless it is
<code>false</code>.</p>

<pre class="ruby"><span class="ruby-node">%w(1 2 3 4 5 6 7 8 9 10)</span>.<span class="ruby-identifier">in_groups_of</span>(<span class="ruby-value">3</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span> <span class="ruby-identifier">group</span>}
[<span class="ruby-string">&quot;1&quot;</span>, <span class="ruby-string">&quot;2&quot;</span>, <span class="ruby-string">&quot;3&quot;</span>]
[<span class="ruby-string">&quot;4&quot;</span>, <span class="ruby-string">&quot;5&quot;</span>, <span class="ruby-string">&quot;6&quot;</span>]
[<span class="ruby-string">&quot;7&quot;</span>, <span class="ruby-string">&quot;8&quot;</span>, <span class="ruby-string">&quot;9&quot;</span>]
[<span class="ruby-string">&quot;10&quot;</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>]

<span class="ruby-node">%w(1 2 3 4 5)</span>.<span class="ruby-identifier">in_groups_of</span>(<span class="ruby-value">2</span>, <span class="ruby-string">'&amp;nbsp;'</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span> <span class="ruby-identifier">group</span>}
[<span class="ruby-string">&quot;1&quot;</span>, <span class="ruby-string">&quot;2&quot;</span>]
[<span class="ruby-string">&quot;3&quot;</span>, <span class="ruby-string">&quot;4&quot;</span>]
[<span class="ruby-string">&quot;5&quot;</span>, <span class="ruby-string">&quot;&amp;nbsp;&quot;</span>]

<span class="ruby-node">%w(1 2 3 4 5)</span>.<span class="ruby-identifier">in_groups_of</span>(<span class="ruby-value">2</span>, <span class="ruby-keyword">false</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span> <span class="ruby-identifier">group</span>}
[<span class="ruby-string">&quot;1&quot;</span>, <span class="ruby-string">&quot;2&quot;</span>]
[<span class="ruby-string">&quot;3&quot;</span>, <span class="ruby-string">&quot;4&quot;</span>]
[<span class="ruby-string">&quot;5&quot;</span>]
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-in_groups_of_source')" id="l_method-i-in_groups_of_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/3c4a0b2e6807cfb67d4ee76a15c8b8a242f12bdf/activesupport/lib/active_support/core_ext/array/grouping.rb#L20" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-in_groups_of_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/grouping.rb, line 20</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">in_groups_of</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">fill_with</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">fill_with</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span>
    <span class="ruby-identifier">collection</span> = <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-comment"># size % number gives how many extra we have;</span>
    <span class="ruby-comment"># subtracting from number gives how many to add;</span>
    <span class="ruby-comment"># modulo number ensures we don't add group of just fill.</span>
    <span class="ruby-identifier">padding</span> = (<span class="ruby-identifier">number</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">number</span>) <span class="ruby-operator">%</span> <span class="ruby-identifier">number</span>
    <span class="ruby-identifier">collection</span> = <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">concat</span>([<span class="ruby-identifier">fill_with</span>] * <span class="ruby-identifier">padding</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-identifier">number</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">slice</span><span class="ruby-operator">|</span> <span class="ruby-keyword">yield</span>(<span class="ruby-identifier">slice</span>) }
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">groups</span> = []
    <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">each_slice</span>(<span class="ruby-identifier">number</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span> <span class="ruby-identifier">groups</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">group</span> }
    <span class="ruby-identifier">groups</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-second">
            
              <b>second</b>()
            
            <a href="Array.html#method-i-second" name="method-i-second" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Equal to <code>self[1]</code>.</p>

<pre class="ruby"><span class="ruby-node">%w( a b c d e )</span>.<span class="ruby-identifier">second</span> <span class="ruby-comment"># =&gt; &quot;b&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-second_source')" id="l_method-i-second_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/139461fc144983186c96bd50388d463895201ad3/activesupport/lib/active_support/core_ext/array/access.rb#L25" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-second_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/access.rb, line 25</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">second</span>
  <span class="ruby-keyword">self</span>[<span class="ruby-number">1</span>]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-split">
            
              <b>split</b>(value = nil, &amp;block)
            
            <a href="Array.html#method-i-split" name="method-i-split" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Divides the array into one or more subarrays based on a delimiting
<code>value</code> or the result of an optional block.</p>

<pre class="ruby">[<span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>, <span class="ruby-value">5</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value">3</span>)              <span class="ruby-comment"># =&gt; [[1, 2], [4, 5]]</span>
(<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">10</span>).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">split</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">%</span> <span class="ruby-value">3</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> } <span class="ruby-comment"># =&gt; [[1, 2], [4, 5], [7, 8], [10]]</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-split_source')" id="l_method-i-split_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/3c4a0b2e6807cfb67d4ee76a15c8b8a242f12bdf/activesupport/lib/active_support/core_ext/array/grouping.rb#L88" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-split_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/grouping.rb, line 88</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">split</span>(<span class="ruby-identifier">value</span> = <span class="ruby-keyword">nil</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">inject</span>([[]]) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">results</span>, <span class="ruby-identifier">element</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">block</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">element</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">element</span>
      <span class="ruby-identifier">results</span> <span class="ruby-operator">&lt;&lt;</span> []
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">results</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">element</span>
    <span class="ruby-keyword">end</span>

    <span class="ruby-identifier">results</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-third">
            
              <b>third</b>()
            
            <a href="Array.html#method-i-third" name="method-i-third" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Equal to <code>self[2]</code>.</p>

<pre class="ruby"><span class="ruby-node">%w( a b c d e )</span>.<span class="ruby-identifier">third</span> <span class="ruby-comment"># =&gt; &quot;c&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-third_source')" id="l_method-i-third_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/139461fc144983186c96bd50388d463895201ad3/activesupport/lib/active_support/core_ext/array/access.rb#L32" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-third_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/access.rb, line 32</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">third</span>
  <span class="ruby-keyword">self</span>[<span class="ruby-number">2</span>]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to">
            
              <b>to</b>(position)
            
            <a href="Array.html#method-i-to" name="method-i-to" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the beginning of the array up to <code>position</code>.</p>

<pre class="ruby"><span class="ruby-node">%w( a b c d )</span>.<span class="ruby-identifier">to</span>(<span class="ruby-value">0</span>)  <span class="ruby-comment"># =&gt; [&quot;a&quot;]</span>
<span class="ruby-node">%w( a b c d )</span>.<span class="ruby-identifier">to</span>(<span class="ruby-value">2</span>)  <span class="ruby-comment"># =&gt; [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]</span>
<span class="ruby-node">%w( a b c d )</span>.<span class="ruby-identifier">to</span>(<span class="ruby-value">10</span>) <span class="ruby-comment"># =&gt; [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;]</span>
<span class="ruby-node">%w()</span>.<span class="ruby-identifier">to</span>(<span class="ruby-value">0</span>)           <span class="ruby-comment"># =&gt; []</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_source')" id="l_method-i-to_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/139461fc144983186c96bd50388d463895201ad3/activesupport/lib/active_support/core_ext/array/access.rb#L18" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/access.rb, line 18</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to</span>(<span class="ruby-identifier">position</span>)
  <span class="ruby-identifier">first</span> <span class="ruby-identifier">position</span> <span class="ruby-operator">+</span> <span class="ruby-number">1</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_default_s">
            
              <b>to_default_s</b>(format = :default)
            
            <a href="Array.html#method-i-to_default_s" name="method-i-to_default_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_formatted_s">
            
              <b>to_formatted_s</b>(format = :default)
            
            <a href="Array.html#method-i-to_formatted_s" name="method-i-to_formatted_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts a collection of elements into a formatted string by calling
<code>to_s</code> on all elements and joining them. Having this model:</p>

<pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">Blog</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
    <span class="ruby-identifier">title</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>

<span class="ruby-constant">Blog</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">map</span>(&amp;:<span class="ruby-identifier">title</span>) <span class="ruby-comment">#=&gt; [&quot;First Post&quot;, &quot;Second Post&quot;, &quot;Third post&quot;]</span>
</pre>

<p><code>to_formatted_s</code> shows us:</p>

<pre class="ruby"><span class="ruby-constant">Blog</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">to_formatted_s</span> <span class="ruby-comment"># =&gt; &quot;First PostSecond PostThird Post&quot;</span>
</pre>

<p>Adding in the <code>:db</code> argument as the format yields a comma
separated id list:</p>

<pre class="ruby"><span class="ruby-constant">Blog</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">db</span>) <span class="ruby-comment"># =&gt; &quot;1,2,3&quot;</span>
</pre>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Array.html#method-i-to_s">to_s</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_formatted_s_source')" id="l_method-i-to_formatted_s_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/7755ae7ba6d64207892f079587e0d6e56396c809/activesupport/lib/active_support/core_ext/array/conversions.rb#L104" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_formatted_s_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/conversions.rb, line 104</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_formatted_s</span>(<span class="ruby-identifier">format</span> = <span class="ruby-value">:default</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">format</span>
  <span class="ruby-keyword">when</span> <span class="ruby-value">:db</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">empty?</span>
      <span class="ruby-string">'null'</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">element</span><span class="ruby-operator">|</span> <span class="ruby-identifier">element</span>.<span class="ruby-identifier">id</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-string">','</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">to_default_s</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_param">
            
              <b>to_param</b>()
            
            <a href="Array.html#method-i-to_param" name="method-i-to_param" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Calls <code>to_param</code> on all its elements and joins the result with
slashes. This is used by <code>url_for</code> in Action Pack.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_param_source')" id="l_method-i-to_param_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/03404936945b452b8e66e53e183973176dae8301/activesupport/lib/active_support/core_ext/object/to_param.rb#L32" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_param_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/to_param.rb, line 32</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_param</span>
  <span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_param</span> }.<span class="ruby-identifier">join</span> <span class="ruby-string">'/'</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_query">
            
              <b>to_query</b>(key)
            
            <a href="Array.html#method-i-to_query" name="method-i-to_query" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts an array into a string suitable for use as a URL query string,
using the given <code>key</code> as the param name.</p>

<pre class="ruby">[<span class="ruby-string">'Rails'</span>, <span class="ruby-string">'coding'</span>].<span class="ruby-identifier">to_query</span>(<span class="ruby-string">'hobbies'</span>) <span class="ruby-comment"># =&gt; &quot;hobbies%5B%5D=Rails&amp;hobbies%5B%5D=coding&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_query_source')" id="l_method-i-to_query_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/3a04e370e4cc016bb7b59fe6bb704e4ca37d62f3/activesupport/lib/active_support/core_ext/object/to_query.rb#L19" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_query_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/object/to_query.rb, line 19</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_query</span>(<span class="ruby-identifier">key</span>)
  <span class="ruby-identifier">prefix</span> = <span class="ruby-node">&quot;#{key}[]&quot;</span>
  <span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_query</span>(<span class="ruby-identifier">prefix</span>) }.<span class="ruby-identifier">join</span> <span class="ruby-string">'&amp;'</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_s">
            
              <b>to_s</b>(format = :default)
            
            <a href="Array.html#method-i-to_s" name="method-i-to_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Array.html#method-i-to_default_s">to_default_s</a>
            </div>
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_sentence">
            
              <b>to_sentence</b>(options = {})
            
            <a href="Array.html#method-i-to_sentence" name="method-i-to_sentence" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts the array to a comma-separated sentence where the last element is
joined by the connector word.</p>

<p>You can pass the following options to change the default behavior. If you
pass an option key that doesn’t exist in the list below, it will raise an
<code>ArgumentError</code>.</p>

<h4 id="method-i-to_sentence-label-Options">Options</h4>
<ul><li>
<p><code>:words_connector</code> - The sign or word used to join the elements
in arrays with two or more elements (default: ", ").</p>
</li><li>
<p><code>:two_words_connector</code> - The sign or word used to join the
elements in arrays with two elements (default: " and ").</p>
</li><li>
<p><code>:last_word_connector</code> - The sign or word used to join the last
element in arrays with three or more elements (default: ", and ").</p>
</li><li>
<p><code>:locale</code> - If <code>i18n</code> is available, you can set a
locale and use the connector options defined on the 'support.array'
namespace in the corresponding dictionary file.</p>
</li></ul>

<h4 id="method-i-to_sentence-label-Examples">Examples</h4>

<pre class="ruby">[].<span class="ruby-identifier">to_sentence</span>                      <span class="ruby-comment"># =&gt; &quot;&quot;</span>
[<span class="ruby-string">'one'</span>].<span class="ruby-identifier">to_sentence</span>                 <span class="ruby-comment"># =&gt; &quot;one&quot;</span>
[<span class="ruby-string">'one'</span>, <span class="ruby-string">'two'</span>].<span class="ruby-identifier">to_sentence</span>          <span class="ruby-comment"># =&gt; &quot;one and two&quot;</span>
[<span class="ruby-string">'one'</span>, <span class="ruby-string">'two'</span>, <span class="ruby-string">'three'</span>].<span class="ruby-identifier">to_sentence</span> <span class="ruby-comment"># =&gt; &quot;one, two, and three&quot;</span>

[<span class="ruby-string">'one'</span>, <span class="ruby-string">'two'</span>].<span class="ruby-identifier">to_sentence</span>(<span class="ruby-identifier">passing</span><span class="ruby-operator">:</span> <span class="ruby-string">'invalid option'</span>)
<span class="ruby-comment"># =&gt; ArgumentError: Unknown key :passing</span>

[<span class="ruby-string">'one'</span>, <span class="ruby-string">'two'</span>].<span class="ruby-identifier">to_sentence</span>(<span class="ruby-identifier">two_words_connector</span><span class="ruby-operator">:</span> <span class="ruby-string">'-'</span>)
<span class="ruby-comment"># =&gt; &quot;one-two&quot;</span>

[<span class="ruby-string">'one'</span>, <span class="ruby-string">'two'</span>, <span class="ruby-string">'three'</span>].<span class="ruby-identifier">to_sentence</span>(<span class="ruby-identifier">words_connector</span><span class="ruby-operator">:</span> <span class="ruby-string">' or '</span>, <span class="ruby-identifier">last_word_connector</span><span class="ruby-operator">:</span> <span class="ruby-string">' or at least '</span>)
<span class="ruby-comment"># =&gt; &quot;one or two or at least three&quot;</span>
</pre>

<p>Using <code>:locale</code> option:</p>

<pre class="ruby"><span class="ruby-comment"># Given this locale dictionary:</span>
<span class="ruby-comment">#</span>
<span class="ruby-comment">#   es:</span>
<span class="ruby-comment">#     support:</span>
<span class="ruby-comment">#       array:</span>
<span class="ruby-comment">#         words_connector: &quot; o &quot;</span>
<span class="ruby-comment">#         two_words_connector: &quot; y &quot;</span>
<span class="ruby-comment">#         last_word_connector: &quot; o al menos &quot;</span>

[<span class="ruby-string">'uno'</span>, <span class="ruby-string">'dos'</span>].<span class="ruby-identifier">to_sentence</span>(<span class="ruby-identifier">locale</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">es</span>)
<span class="ruby-comment"># =&gt; &quot;uno y dos&quot;</span>

[<span class="ruby-string">'uno'</span>, <span class="ruby-string">'dos'</span>, <span class="ruby-string">'tres'</span>].<span class="ruby-identifier">to_sentence</span>(<span class="ruby-identifier">locale</span><span class="ruby-operator">:</span> :<span class="ruby-identifier">es</span>)
<span class="ruby-comment"># =&gt; &quot;uno o dos o al menos tres&quot;</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_sentence_source')" id="l_method-i-to_sentence_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/7755ae7ba6d64207892f079587e0d6e56396c809/activesupport/lib/active_support/core_ext/array/conversions.rb#L59" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_sentence_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/conversions.rb, line 59</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_sentence</span>(<span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">assert_valid_keys</span>(<span class="ruby-value">:words_connector</span>, <span class="ruby-value">:two_words_connector</span>, <span class="ruby-value">:last_word_connector</span>, <span class="ruby-value">:locale</span>)

  <span class="ruby-identifier">default_connectors</span> = {
    <span class="ruby-value">:words_connector</span>     =<span class="ruby-operator">&gt;</span> <span class="ruby-string">', '</span>,
    <span class="ruby-value">:two_words_connector</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">' and '</span>,
    <span class="ruby-value">:last_word_connector</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">', and '</span>
  }
  <span class="ruby-keyword">if</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">I18n</span>)
    <span class="ruby-identifier">i18n_connectors</span> = <span class="ruby-constant">I18n</span>.<span class="ruby-identifier">translate</span>(<span class="ruby-value">:'support.array'</span>, <span class="ruby-identifier">locale</span><span class="ruby-operator">:</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:locale</span>], <span class="ruby-identifier">default</span><span class="ruby-operator">:</span> {})
    <span class="ruby-identifier">default_connectors</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">i18n_connectors</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">default_connectors</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">options</span>)

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">length</span>
  <span class="ruby-keyword">when</span> <span class="ruby-number">0</span>
    <span class="ruby-string">''</span>
  <span class="ruby-keyword">when</span> <span class="ruby-number">1</span>
    <span class="ruby-keyword">self</span>[<span class="ruby-number">0</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-keyword">when</span> <span class="ruby-number">2</span>
    <span class="ruby-node">&quot;#{self[0]}#{options[:two_words_connector]}#{self[1]}&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-node">&quot;#{self[0...-1].join(options[:words_connector])}#{options[:last_word_connector]}#{self[-1]}&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_xml">
            
              <b>to_xml</b>(options = {})
            
            <a href="Array.html#method-i-to_xml" name="method-i-to_xml" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a string that represents the array in XML by invoking
<code>to_xml</code> on each element. Active Record collections delegate
their representation in XML to this method.</p>

<p>All elements are expected to respond to <code>to_xml</code>, if any of them
does not then an exception is raised.</p>

<p>The root node reflects the class name of the first element in plural if all
elements belong to the same type and that’s not Hash:</p>

<pre>customer.projects.to_xml

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;projects type=&quot;array&quot;&gt;
  &lt;project&gt;
    &lt;amount type=&quot;decimal&quot;&gt;20000.0&lt;/amount&gt;
    &lt;customer-id type=&quot;integer&quot;&gt;1567&lt;/customer-id&gt;
    &lt;deal-date type=&quot;date&quot;&gt;2008-04-09&lt;/deal-date&gt;
    ...
  &lt;/project&gt;
  &lt;project&gt;
    &lt;amount type=&quot;decimal&quot;&gt;57230.0&lt;/amount&gt;
    &lt;customer-id type=&quot;integer&quot;&gt;1567&lt;/customer-id&gt;
    &lt;deal-date type=&quot;date&quot;&gt;2008-04-15&lt;/deal-date&gt;
    ...
  &lt;/project&gt;
&lt;/projects&gt;</pre>

<p>Otherwise the root element is “objects”:</p>

<pre>[{ foo: 1, bar: 2}, { baz: 3}].to_xml

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;objects type=&quot;array&quot;&gt;
  &lt;object&gt;
    &lt;bar type=&quot;integer&quot;&gt;2&lt;/bar&gt;
    &lt;foo type=&quot;integer&quot;&gt;1&lt;/foo&gt;
  &lt;/object&gt;
  &lt;object&gt;
    &lt;baz type=&quot;integer&quot;&gt;3&lt;/baz&gt;
  &lt;/object&gt;
&lt;/objects&gt;</pre>

<p>If the collection is empty the root element is “nil-classes” by default:</p>

<pre>[].to_xml

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;nil-classes type=&quot;array&quot;/&gt;</pre>

<p>To ensure a meaningful root element use the <code>:root</code> option:</p>

<pre>customer_with_no_projects.projects.to_xml(root: 'projects')

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;projects type=&quot;array&quot;/&gt;</pre>

<p>By default name of the node for the children of root is
<code>root.singularize</code>. You can change it with the
<code>:children</code> option.</p>

<p>The <code>options</code> hash is passed downwards:</p>

<pre>Message.all.to_xml(skip_types: true)

&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;messages&gt;
  &lt;message&gt;
    &lt;created-at&gt;2008-03-07T09:58:18+01:00&lt;/created-at&gt;
    &lt;id&gt;1&lt;/id&gt;
    &lt;name&gt;1&lt;/name&gt;
    &lt;updated-at&gt;2008-03-07T09:58:18+01:00&lt;/updated-at&gt;
    &lt;user-id&gt;1&lt;/user-id&gt;
  &lt;/message&gt;
&lt;/messages&gt;</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_xml_source')" id="l_method-i-to_xml_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/7755ae7ba6d64207892f079587e0d6e56396c809/activesupport/lib/active_support/core_ext/array/conversions.rb#L194" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_xml_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/conversions.rb, line 194</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_xml</span>(<span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">require</span> <span class="ruby-string">'active_support/builder'</span> <span class="ruby-keyword">unless</span> <span class="ruby-keyword">defined?</span>(<span class="ruby-constant">Builder</span>)

  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">options</span>[<span class="ruby-value">:indent</span>]  <span class="ruby-operator">||=</span> <span class="ruby-number">2</span>
  <span class="ruby-identifier">options</span>[<span class="ruby-value">:builder</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">Builder</span><span class="ruby-operator">::</span><span class="ruby-constant">XmlMarkup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">indent</span><span class="ruby-operator">:</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:indent</span>])
  <span class="ruby-identifier">options</span>[<span class="ruby-value">:root</span>]    <span class="ruby-operator">||=</span>        <span class="ruby-keyword">if</span> <span class="ruby-identifier">first</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">all?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-identifier">first</span>.<span class="ruby-identifier">class</span>) }
      <span class="ruby-identifier">underscored</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">underscore</span>(<span class="ruby-identifier">first</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>)
      <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">pluralize</span>(<span class="ruby-identifier">underscored</span>).<span class="ruby-identifier">tr</span>(<span class="ruby-string">'/'</span>, <span class="ruby-string">'_'</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-string">'objects'</span>
    <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">builder</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:builder</span>]
  <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">instruct!</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:skip_instruct</span>)

  <span class="ruby-identifier">root</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">XmlMini</span>.<span class="ruby-identifier">rename_key</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:root</span>].<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">children</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:children</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">root</span>.<span class="ruby-identifier">singularize</span>
  <span class="ruby-identifier">attributes</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:skip_types</span>] <span class="ruby-operator">?</span> {} <span class="ruby-operator">:</span> { <span class="ruby-identifier">type</span><span class="ruby-operator">:</span> <span class="ruby-string">'array'</span> }

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">empty?</span>
    <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">tag!</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">attributes</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">tag!</span>(<span class="ruby-identifier">root</span>, <span class="ruby-identifier">attributes</span>) <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">XmlMini</span>.<span class="ruby-identifier">to_tag</span>(<span class="ruby-identifier">children</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">options</span>) }
      <span class="ruby-keyword">yield</span> <span class="ruby-identifier">builder</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-uniq_by">
            
              <b>uniq_by</b>(&amp;block)
            
            <a href="Array.html#method-i-uniq_by" name="method-i-uniq_by" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p><strong>DEPRECATED</strong>: Use <code>Array#uniq</code> instead.</p>

<p>Returns a unique array based on the criteria in the block.</p>

<pre class="ruby">[<span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-value">3</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">uniq_by</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">odd?</span> } <span class="ruby-comment"># =&gt; [1, 2]</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-uniq_by_source')" id="l_method-i-uniq_by_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f8dbe4c7cc9d2109781c7283bd0d8617db6f2c09/activesupport/lib/active_support/core_ext/array/uniq_by.rb#L7" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-uniq_by_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/uniq_by.rb, line 7</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">uniq_by</span>(&amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">warn</span> <span class="ruby-string">'uniq_by is deprecated. Use Array#uniq instead'</span>
  <span class="ruby-identifier">uniq</span>(&amp;<span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-uniq_by-21">
            
              <b>uniq_by!</b>(&amp;block)
            
            <a href="Array.html#method-i-uniq_by-21" name="method-i-uniq_by-21" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p><strong>DEPRECATED</strong>: Use <code>Array#uniq!</code> instead.</p>

<p>Same as <code>uniq_by</code>, but modifies <code>self</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-uniq_by-21_source')" id="l_method-i-uniq_by-21_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/f8dbe4c7cc9d2109781c7283bd0d8617db6f2c09/activesupport/lib/active_support/core_ext/array/uniq_by.rb#L15" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-uniq_by-21_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/array/uniq_by.rb, line 15</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">uniq_by!</span>(&amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">warn</span> <span class="ruby-string">'uniq_by! is deprecated. Use Array#uniq! instead'</span>
  <span class="ruby-identifier">uniq!</span>(&amp;<span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    